/*What is the largest prime factor of the number 600851475143 ?*/

#include <stdio.h>

int main(int argc, char** argv) {
	long n = atol(argv[1]);
	printf("%ld\n", n);
	long result = find_highest_prime_factor(n);
	printf("%ld\n", result);
	return(0);
}

long find_highest_prime_factor(long n) {
	long i;
	for (i = n; i > 0; i = i - 2) {
		if (is_prime_factor(i, n)) {
			return i;
		}
	}
	return i;
}

bool is_prime_factor(long n, long of) {
	return is_factor(n, of) && is_prime(n);
}

bool is_factor(long n, long of) {
	return of % n == 0;
}

bool is_prime(long n) {
	long i;
	for (i = 2; i < sqrt(n); i++) {
		if (n % i == 0) {
			return false;
		} 
	}

	return true;
}
